﻿<UserControl x:Class="EdiApp.Views.Shell.StatusBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="30" d:DesignWidth="500"
             
             xmlns:cmdLabel="clr-namespace:Util.Local;assembly=Util"
             xmlns:conv="clr-namespace:Edi.Core.Converters;assembly=Edi.Core"
             xmlns:adconv="clr-namespace:EdiDocuments.Converter;assembly=EdiDocuments"
						 Visibility="{Binding IsWorkspaceAreaOptimized, Converter={conv:BoolToVisibilityConverter}, ConverterParameter=true}">
	<UserControl.Resources>
    <conv:BooleanToTypeModeStringConverter x:Key="DisplayTypeModeConverter" />
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  </UserControl.Resources>
	<Grid>
    <StatusBar HorizontalAlignment="Stretch">
      <StatusBarItem HorizontalAlignment="Stretch">
        <TextBlock Text="{x:Static cmdLabel:Strings.STR_StatusBar_Ready}"
                   Grid.Column="0" Margin="0,0,3,0" HorizontalAlignment="Stretch"/>
      </StatusBarItem>

      <StatusBarItem HorizontalAlignment="Right" VerticalContentAlignment="Center" VerticalAlignment="Center">
        <Grid Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right"
              Visibility="{Binding Path=ActiveDocument, Mode=OneWay, Converter={adconv:ActiveDocumentToVisibilityConverter}}">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>

          <Grid Grid.Column="0" Margin="3,0" VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{x:Static cmdLabel:Strings.STR_StatusBar_X_Coord_Label}"
                       ToolTip="{x:Static cmdLabel:Strings.STR_StatusBar_X_Coord_Label_TT}"
                       Margin="3,0" Grid.Column="0"/>
            <TextBlock Text="{Binding ActiveEdiDocument.Column, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                       ToolTip="{x:Static cmdLabel:Strings.STR_StatusBar_X_Coord_Label_TT}"
                       Margin="3,0" Grid.Column="1" MinWidth="10" HorizontalAlignment="Left" />
          </Grid>

          <Grid Grid.Column="1" Margin="3,0">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{x:Static cmdLabel:Strings.STR_StatusBar_Y_Coord_Label}"
                       ToolTip="{x:Static cmdLabel:Strings.STR_StatusBar_Y_Coord_Label_TT}"
                       Margin="3,0" Grid.Column="0"/>
            <TextBlock Text="{Binding ActiveEdiDocument.Line, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                       ToolTip="{x:Static cmdLabel:Strings.STR_StatusBar_Y_Coord_Label_TT}"
                       Foreground="{DynamicResource StatusBarForegroundColor}"
                       Margin="3,0" Grid.Column="1" MinWidth="10" HorizontalAlignment="Left" />
          </Grid>

          <TextBlock Text="{Binding TextOptions.IsInsertMode, Converter={StaticResource DisplayTypeModeConverter}, Mode=OneWay}"
                     ToolTip="{x:Static cmdLabel:Strings.STR_Insert_Overtype_Mode_TT}"
                     DataContext="{Binding ActiveEdiDocument}" Margin="3, 0" Grid.Column="2"/>

          <TextBlock Text="{Binding FileEncoding.EncodingName, Mode=OneWay}"
                     ToolTip="{x:Static cmdLabel:Strings.STR_StatusBar_Textencoding_TT}"
                     DataContext="{Binding ActiveEdiDocument}" Margin="3, 0" Grid.Column="3"/>

          <!-- x:Name="ResizeGrip" -->
          <Path Grid.Column="4"
                Visibility="{Binding IsNotMaximized, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                Width="12" Height="12" Margin="1" HorizontalAlignment="Right" 
                Stroke="{DynamicResource WindowText}"
                StrokeThickness="1"
                Stretch="None"
                Data="F1 M1,10 L3,10 M5,10 L7,10 M9,10 L11,10 M2,9 L2,11 M6,9 L6,11 M10,9 L10,11 M5,6 L7,6 M9,6 L11,6 M6,5 L6,7 M10,5 L10,7 M9,2 L11,2 M10,1 L10,3" />
        </Grid>
      </StatusBarItem>
    </StatusBar>
  </Grid>
</UserControl>
